<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateArticleTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('article', function (Blueprint $table) {
            $table->increments('id');
            $table->string('author', 30)->comment('作者');
            $table->tinyInteger('category')->default(1)->comment('文章类别');
            $table->string('thumb', 50)->default('')->comment('缩略图');
            $table->string('title', 50)->default('')->comment('标题');
            $table->string('sub_text', 100)->default('')->comment('文章描述');
            $table->text('content')->nullable()->comment('文章正文');
            $table->timestamps();
            $table->tinyInteger('flag')->default(1)->comment('文章状态');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('article');
    }
}
